package com.zhangchao.day_book.bizc.impl;


import com.zhangchao.day_book.bizc.AnnexService;
import com.zhangchao.day_book.mapper.AnnexMapper;
import com.zhangchao.day_book.model.AnnexExample;
import com.zhangchao.day_book.po.Annex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IAnnexService implements AnnexService {

    @Autowired
    private  AnnexMapper annexMapper;

    @Override
    public int saveAnnex(Annex annex) {
        AnnexExample annexExample = new AnnexExample();
        AnnexExample.Criteria Criteria = annexExample.createCriteria();
        Criteria.andAnnexCreatorEqualTo("");
        return annexMapper.insertSelective(annex);
    }

    @Override
    public int updateAnnex(Annex annex) {
        AnnexExample annexExample = new AnnexExample();
        AnnexExample.Criteria Criteria = annexExample.createCriteria();
        return annexMapper.updateByExampleSelective(annex,annexExample);
    }

    @Override
    public int deleteAnnex(String annexNo) {
        AnnexExample annexExample = new AnnexExample();
        AnnexExample.Criteria Criteria = annexExample.createCriteria();
        return annexMapper.deleteByPrimaryKey(annexNo);
    }

    @Override
    public List<Annex> queryAnnex() {
        AnnexExample annexExample = new AnnexExample();
        AnnexExample.Criteria Criteria = annexExample.createCriteria();
        return annexMapper.selectByExample(annexExample);
    }
}
